/************************************************
 * Lab4A.cpp
 *
 *  Created on: Feb 18, 2014
 *      Author: A Varghese
 ************************************************/

#include <iostream>
using namespace std;

/*************************************************************
 * A simple class with two data members and three methods.
 *************************************************************/
class MyData{
public:
	static const int DATA_SIZE = 10;
	/*
	 * Constructor for MyData
	 */
	MyData(int id_in, double data_in[DATA_SIZE] ){
		if (id_in > 0)
			id = id_in;
		else
			id = 0;
//		data = data_in;
	};
	/*
	 * get methods
	 */
	int getID(){
		return id;
	};
	/*
	 * The body of this set method is at the end of this file
	 */
	void setID(int i);
	double getSum();
private:
	int id;
	double data[ DATA_SIZE ];
};
/*************************************************************/

int main(){
	double array1[ MyData::DATA_SIZE ] = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4 };
	double array2[ MyData::DATA_SIZE ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

	MyData data1( 10, array1);
	MyData data2( -10, array2 );
	cout << " The data1 object has " << data1.getID() << " and sum "
		 << data1.getSum() << endl;
	cout << " The data2 object has " << data2.getID() << " and sum "
		 << data2.getSum() << endl << endl;

	/*
	 * Now, let's change array1 and see what happens to our object.
	 */
	array1[3] = 20;

	/*
	 * Now that we have changed the array1 variable,
	 * does this change data1? Let's find out:
	 */
	cout << " The data1 object has " << data1.getID() << " and sum "
		 << data1.getSum() << endl;

}
/*
 * Implementation of the setID method of the MyData class
 */
void MyData::setID(int i){
	if (i>0)
		id = i;
}
/*
 * Implementation of the getSum method of the MyData class
 */
double MyData::getSum(){
	return 0;
}
